#pragma once
#include<iostream>
#include<ctime>

#define INF 0
#define DEG 1
#define ERR 2
#define DEFAULT_LOG_LEVEL INF
#define LOG(level,format,...)  do\
{\
    if(level < DEFAULT_LOG_LEVEL)\
    {\
        break;\
    }\
    time_t t = time(nullptr);\
    struct tm lt;\
    localtime_r(&t,&lt);\
    char buffer[32];\
    strftime(buffer,sizeof(buffer),"%H:%M:%S",&lt);\
    fprintf(stdout,"[%s %s:%d]" format "\n",buffer,__FILE__,__LINE__,##__VA_ARGS__);\
}while(0)
#define ILOG(format,...) LOG(INF,format,##__VA_ARGS__)
#define DLOG(format,...) LOG(DEG,format,##__VA_ARGS__)
#define ELOG(format,...) LOG(ERR,format,##__VA_ARGS__)

